<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript" charset="utf-8"></script>

<script>
    wx.config({!!$js->config(array('onMenuShareQQ', 'onMenuShareWeibo','chooseWXPay'), false) !!});

    //调用微信JS api 支付
    function jsApiCall()
    {
        $.post('/payfor',{type:1},function(data){
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',data.msg,
                function(res){
                   local.href='';
                }
            );
        })
        return ;

    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
    callpay();
</script>